package main.collection;

import com.google.gson.Gson;

/**
 * Created by ChengGM on 2016/12/20.
 */
class Dog implements Cloneable{
    private Long age;
    private Long number;

    public Long getAge() {
        return age;
    }

    public void setAge(Long age) {
        this.age = age;
    }

    public Long getNumber() {
        return number;
    }

    public void setNumber(Long number) {
        this.number = number;
    }
    public Object clone(){
        Dog dog = null;
        try{
            dog = (Dog)super.clone();
        }catch (Exception e){
            e.printStackTrace();
        }
        return dog;
    }
}
public class CloneTest {
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.setAge(3L);
        dog.setNumber(100L);
        Dog dog1 = (Dog)dog.clone();
        Gson gson = new Gson();
        System.out.println(gson.toJson(dog1));

    }
}
